package edu.sdwu.liqing.qasystem.config;


import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import edu.sdwu.liqing.qasystem.handler.MybatisPlusMetaObjectHandler;
import edu.sdwu.liqing.qasystem.util.RequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
@Slf4j
public class MyBatisPlusConfig {


    @Bean
    public PaginationInterceptor paginationInterceptor() {
        log.info("注册分页插件");
        return new PaginationInterceptor().setLimit(-1);
    }




    @Bean
    @Autowired
    public MybatisPlusMetaObjectHandler metaObjectHandler(RequestUtil requestUtil) {
        return new MybatisPlusMetaObjectHandler(requestUtil);
    }



}